package com.atguigu.i_sorted;

import java.util.Comparator;
import java.util.stream.Stream;

public class Demo {
    public static void main(String[] args) {
        //进工厂
        Stream<Integer> stream = Stream.of(3, 1, 4, 2, 5);

        //进排序车间
        //Stream<Integer> sorted = stream.sorted();
        Stream<Integer> sorted = stream.sorted(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });

        //出工厂
        sorted.forEach(System.out::println);
    }
}
